using RBAC.Domain;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;

namespace RBAC.Domain.ArrivalInspection
{
    /// <summary>
    /// 到货检验单（单头）
    /// </summary>
    [Table("ArrivalInspectionInfo")]
    public class ArrivalInspectionInfo : BaseEntity
    {
        /// <summary>
        /// 检验单号（系统编号）
        /// </summary>
        public string DocCode { get; set; }

        /// <summary>
        /// 检验主题
        /// </summary>
        public string Subject { get; set; }

        /// <summary>
        /// 检验日期
        /// </summary>
        public DateTime InspectionDate { get; set; }

        /// <summary>
        /// 检验人员
        /// </summary>
        public string Inspector { get; set; }

        /// <summary>
        /// 所在部门
        /// </summary>
        public string Department { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        // 采购相关信息（从选择的采购订单带出）
        /// <summary>
        /// 采购单号
        /// </summary>
        public string PurchaseOrderNo { get; set; }

        /// <summary>
        /// 供应商ID
        /// </summary>
        public string SupplierId { get; set; }

        /// <summary>
        /// 供应商名称（冗余，便于列表展示）
        /// </summary>
        public string SupplierName { get; set; }

        /// <summary>
        /// 采购日期
        /// </summary>
        public DateTime? PurchaseDate { get; set; }

        /// <summary>
        /// 采购联系人
        /// </summary>
        public string PurchaseContact { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        public string ContactPhone { get; set; }

        /// <summary>
        /// 采购人员
        /// </summary>
        public string Buyer { get; set; }

        /// <summary>
        /// 采购部门
        /// </summary>
        public string PurchaseDept { get; set; }

        /// <summary>
        /// 关联项目（可选）
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 单据状态（草稿/已提交/已审核等）
        /// </summary>
        public string DocStatus { get; set; }

        /// <summary>
        /// 业务状态 0正常 1挂起 2关闭 3完成
        /// </summary>
        public int BizStatus { get; set; } = 0;

        /// <summary>
        /// 审核人
        /// </summary>
        public string Auditor { get; set; }

        /// <summary>
        /// 审核日期
        /// </summary>
        public DateTime? AuditDate { get; set; }

        /// <summary>
        /// 明细列表（非映射，持久化由明细表完成）
        /// </summary>
        [NotMapped]
        public List<ArrivalInspectionItem> Items { get; set; }

        /// <summary>
        /// 附件列表（非映射，持久化由附件表完成）
        /// </summary>
        [NotMapped]
        public List<ArrivalInspectionAttachment> Attachments { get; set; }
    }
}
